<?php


namespace api\controllers;


use api\components\BaseController;
use common\models\Coupon;
use Yii;

/**
 * 卡券中心
 * Class CouponController
 * @package api\controllers
 */
class CouponController extends BaseController
{
    /**
     * 列表
     * @return array
     */
    public function actionList()
    {
        $get = Yii::$app->request->get();
        $page = $get['page']??1;
        return (new Coupon())->getList(self::$userid,$page);
    }

    /**
     * 领取
     * @return array
     */
    public function actionReceive()
    {
        $post = Yii::$app->request->post();
        $c_id = $post['c_id']??'';
        return (new Coupon())->receive(self::$userid,$c_id);
    }
}